home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / KeyPressManagerPanelBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  5KB  |  135 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  08/13/97    LAB    Removed AutoTab property (It didn't do anything).
  8. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  9.  
  10. /**
  11.  * BeanInfo for KeyPressManagerPanel.
  12.  *
  13.  */
  14.  
  15. public class KeyPressManagerPanelBeanInfo extends SimpleBeanInfo {
  16.  
  17.     /**
  18.      * Constructs a KeyPressManagerPanelBeanInfo object.
  19.      */
  20.     public KeyPressManagerPanelBeanInfo() {
  21.     }
  22.  
  23.     /**
  24.      * Gets a BeanInfo for the superclass of this bean.
  25.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  26.      */
  27.     public BeanInfo[] getAdditionalBeanInfo() {
  28.         try {
  29.             BeanInfo[] bi = new BeanInfo[1];
  30.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  31.             return bi;
  32.         }
  33.         catch (IntrospectionException e) { throw new Error(e.toString());}
  34.     }
  35.  
  36.     /**
  37.      * Gets the SymantecBeanDescriptor for this bean.
  38.      * @return an object of type SymantecBeanDescriptor
  39.      * @see symantec.itools.beans.SymantecBeanDescriptor
  40.      */
  41.     public BeanDescriptor getBeanDescriptor() {
  42.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  43.         String s=group.getString("GroupAWTAdditions"); 
  44.  
  45.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  46.         bd.setFolder(s);
  47.         bd.setToolbar(s);
  48.         bd.setWinHelp("0x123B4");
  49.  
  50.         return (BeanDescriptor) bd;
  51.     }
  52.  
  53.     /**
  54.      * Gets an image that may be used to visually represent this bean
  55.      * (in the toolbar, on a form, etc).
  56.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  57.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  58.      * @return an image for this bean, always color even if requested monochrome
  59.      * @see BeanInfo#ICON_MONO_16x16
  60.      * @see BeanInfo#ICON_COLOR_16x16
  61.      * @see BeanInfo#ICON_MONO_32x32
  62.      * @see BeanInfo#ICON_COLOR_32x32
  63.      */
  64.     public java.awt.Image getIcon(int iconKind) {
  65.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  66.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  67.             java.awt.Image img = loadImage("KeyPressManagerPanelC16.gif");
  68.             return img;
  69.         }
  70.  
  71.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  72.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  73.             java.awt.Image img = loadImage("KeyPressManagerPanelC32.gif");
  74.             return img;
  75.         }
  76.  
  77.         return null;
  78.     }
  79.  
  80.     /**
  81.      * Gets an array of descriptions of the methods used for "connections" by
  82.      * Visual CafΘ's Interaction Wizard.
  83.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  84.      * @return method descriptions for this bean
  85.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  86.      */
  87.     public MethodDescriptor[] getMethodDescriptors() {
  88.         Class[] args;
  89.         ConnectionDescriptor connection;
  90.         java.util.Vector connections;
  91.         java.util.Vector md = new java.util.Vector();
  92.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  93.         String s;
  94.  
  95.         try{
  96.             args = null;
  97.             MethodDescriptor removeDefaultButton = new MethodDescriptor(beanClass.getMethod("removeDefaultButton", args));
  98.  
  99.             connections = new java.util.Vector();
  100.             s=conn.getString("removeDefaultButton"); 
  101.             connection = new ConnectionDescriptor("input", "void", "",
  102.                                     "%name%.removeDefaultButton();",s);
  103.             connections.addElement(connection);
  104.  
  105.             removeDefaultButton.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  106.             md.addElement(removeDefaultButton);
  107.         } catch (Exception e) { throw new Error("removeDefaultButton:: " + e.toString()); }
  108.  
  109.         try{
  110.             args = null;
  111.             MethodDescriptor removeCancelButton = new MethodDescriptor(beanClass.getMethod("removeCancelButton", args));
  112.  
  113.             connections = new java.util.Vector();
  114.             s=conn.getString("removeCancelButton"); 
  115.             connection = new ConnectionDescriptor("input", "void", "",
  116.                                     "%name%.removeCancelButton();",s);
  117.             connections.addElement(connection);
  118.  
  119.             removeCancelButton.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  120.             md.addElement(removeCancelButton);
  121.         } catch (Exception e) { throw new Error("removeCancelButton:: " + e.toString()); }
  122.  
  123.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  124.         md.copyInto(rv);
  125.  
  126.         return rv;
  127.     }
  128.  
  129.     public PropertyDescriptor[] getPropertyDescriptors() {
  130.         return new PropertyDescriptor[0];
  131.     }
  132.  
  133.     private final static Class beanClass = KeyPressManagerPanel.class;
  134.  
  135.     }    //  end of class KeyPressManagerPanelBeanInfo